package com.iflysse.services.impl;

import com.iflysse.dao.UserDao;
import com.iflysse.mapper.UserMapper;
import com.iflysse.pojo.bo.req.UserBoReq;
import com.iflysse.pojo.bo.resp.UserBoResp;
import com.iflysse.pojo.po.req.UserPoReq;
import com.iflysse.pojo.po.resp.UserPoResp;
import com.iflysse.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public UserBoResp login(UserBoReq userBoReq) {
        //TODO 调用dao接口

        UserBoResp userBoResp=new UserBoResp();

        //TODO 根据用户信息，获取用户密码
        UserPoResp userPoResp = userMapper.login(userBoReq);

        //TODO 比对参数密码和数据库密码
        userBoResp.setRole(userPoResp.getRole());
        userBoResp.setUserId(userPoResp.getUserId());
        userBoResp.setToken("token自己设置");
        return userBoResp;
    }
}
